package test.org.lvxiao.example.redis.lock;

import org.lvxiao.example.redis.lock.DistributionLock;
import org.lvxiao.example.redis.lock.DistributionSynchronizedPostProcessor;
import org.lvxiao.example.redis.lock.RedisSimpleDistributionLock;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.redis.connection.RedisConnectionFactory;

@Configuration
@ComponentScan("test.org.lvxiao.example.redis.lock")
@Import(DistributionSynchronizedPostProcessor.class)
@PropertySource("application.properties")
@EnableAutoConfiguration
public class BootStartConfiguration {

	@Bean
	public DistributionLock distributionLock(RedisConnectionFactory factory) {
		return new RedisSimpleDistributionLock(factory);
	}
}
